Grid View Model
Instantiate the GridViewModel
class found within the InfoArch.Web.Mvc.Grid
namespace, allows us to configure all settings that the grid component require. This class facilitates the configuration of grid settings, encompassing tasks such as configuring link for the save of state, link for the execution of drill-through reports, loading of parameters and establishing database connections.
Constructors
Name | Description |
---|---|
GridViewModel() | Initializes a new instance of the GridViewModel class |
GridViewModel(parameters) | Initializes a new instance of the GridViewModel class |
GridViewModel() Constructor
This is the default constructor for the GridViewModel
class, which creates a new instance and initializes all properties to their default values.
GridViewModel(parameters) Constructor
This is the main constructor, it has the following parameters:
PARAMETER | TYPE | DESCRIPTION |
---|---|---|
memoryStream | MemoryStream | Represents in-memory data flow for a grid definition (.dRepX). |
connectionString | String | The connection string used by the component to retrieve its data. See connection strings. |
gridId | String | Definition Identifier. |
htmlFormId | String | Form Identifier of the element containing the grid component. |
rowsPerPage | Int | This option specifies how many records will be displayed per page in the Grid component. Default value: 20 |
enableColumnFinderFeature | Bool | This option allows you to show or hide the search section in the ColumnSelection component. Default value: false |
isGridPagerSimpleMode | Bool | Enable the simplified pager. Default value: true |
fullGridControllerActionPath | String | A String object that specifies the absolute path where the application is hosted to perform the build of the internal paths handle by the component. The recommended path could be the following: HttpContext.Request.Url.AbsolutePath Default value: Empty |
gridActionName | String | A String object that specifies the controller action method to perform the callback of the grid component. Default value: Empty |
drillThroughControllerAction | String | A String object that specifies the controller action method to perform the drill-through execution. Default value: Empty |
saveGridControllerAction | String | A String object that specifies the controller action method to perform the save state action. Default value: Empty |
exportToExcelGridControllerAction | String | A String object that specifies the controller action method to perform the Excel exportation action. Default value: Empty |
Methods
SetState
Sets the state of the grid. It receives a DRevealDataStructure
object with the current state of the grid component.
Definition
public void SetState(DRevealDataStructure gridState)
SetParameters
Sets the global parameters the parameters can be created in the grid definition from its designer, and assigned from the web grid component programmatically. It receives a ParameterItems
object provided by the hosting application.
Definition
public void SetParameters(ParameterItems userParameters)
SetCulture
Sets culture and receives a CultureInfo
object provided by the hosting application.
Definition
public void SetCulture(CultureInfo clientCulture)
LoadDataDrillThrough
Loads the Drill-Through structure when the action excecuted is perform Drill-Through on grid component. It receives a string
object that has parameters required for build it.
Definition
public void LoadDataDrillThrough(string drillThroughParameters)
Serialize
Serializes all structures needed to save grid component status.
Definition
public string Serialize()
Returns string
object encrypted.
AssignUserCustomizationDefinitionModel
Assigns the user customization definition model. It receives an encrypted string
object, which is the result of the Serialize
method.
Definition
public void AssignUserCustomizationDefinitionModel(string userCustomization)
UpdateCustomization
Updates the user customization properties, including applied filters and conditions within the grid component.
Definition
public void UpdateCustomization()
SetCleanColumnsOption
Sets the setting to remove unused columns in the database query generated by the grid component.
Definition
public void SetCleanColumnsOption(bool clean)
LoadInitialConfiguration
The LoadInitialConfiguration
method in GridViewModel
initializes the configuration and prepare the all properties required by the grid component.
Example
GridViewModel viewModel = new GridViewModel(
memoryStream: fileStream,
connectionString: " Data Source=MyServer; Initial Catalog=myDatabase; User ID=myUser; Password=myPassword",
gridId: "grid_id",
htmlFormId: "main_form",
rowsPerPage: 15,
enableColumnFinderFeature: true,
isGridPagerSimpleMode: true,
fullGridControllerActionPath: HttpContext.Request.Url.AbsolutePath,
gridActionName: string.Empty,
drillThroughControllerAction: string.Empty,
saveGridControllerAction: string.Empty,
exportToExcelGridControllerAction: string.Empty
);
viewModel.LoadInitialConfiguration();